package barinadroid.game;

import org.andengine.util.adt.pool.GenericPool;

public class BulletPool extends GenericPool<Bullet>
{
	public static BulletPool instance;

	public static BulletPool sharedBulletPool()
	{
		if(instance == null)
			instance = new BulletPool();
		return instance;
	}

	private BulletPool()
	{
		super();
	}

	@Override
	protected Bullet onAllocatePoolItem()
	{
		return new Bullet();
	}

	protected void onHandleRecycleItem(final Bullet b)
	{
		b.getSprite().clearEntityModifiers();
		b.getSprite().clearUpdateHandlers();
		b.clearEntityModifiers();
		b.clearUpdateHandlers();
		b.detachSelf();
		b.reset();
	}
}